{include file="public/toper" /}
<style>
    .layui-unselect{width: 190px;}
</style>
<div class="x-nav">
  <span class="layui-breadcrumb">
    <a href="">订单管理</a>
    <a href="">订单信息</a>
    <a>
      <cite>订单详情</cite></a>
  </span>
  <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form" id="admin">
        <input type="hidden" value="{$order_info['order_id']}" name="order_id"/>
        <input type="hidden" name="order_type" value="{$order_info['order_type']}">
        <input type="hidden" name="type" value="{$order_info['type']}">
        <div class="layui-form-item">
            <label for="order_sn" class="layui-form-label">
                <span class="x-red">*</span>订单编号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="order_sn" value="{$order_info['order_sn']}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="order_status" class="layui-form-label">
                <span class="x-red">*</span>订单状态
            </label>
            <div class="layui-input-inline">
                {if condition = "$order_info['order_status'] eq 0"}
                   <span style="color:red;">未付款</span>
                {elseif condition = "$order_info['order_status'] eq 1"}
                   <span style="color:green;">已付款</span>
                {elseif condition = "$order_info['order_status'] eq 2"}
                   <span style="color:green;">已发货</span>
                {elseif condition = "$order_info['order_status'] eq 3"}
                   <span style="color:green;">已完成</span>
                {elseif condition = "$order_info['order_status'] eq 4"}
                   <span style="color:red;">已取消</span>
                {elseif condition = "$order_info['order_status'] eq 5"}
                <span style="color:red;">归还中</span>
                {elseif condition = "$order_info['order_status'] eq 6"}
                <span style="color:red;">店铺已收货</span>
                {elseif condition = "$order_info['order_status'] eq 7"}
                <span style="color:red;">已验收</span>
                {elseif condition = "$order_info['order_status'] eq 8"}
                <span style="color:red;">待用户确认</span>
                {elseif condition = "$order_info['order_status'] eq 9"}
                <span style="color:red;">待用户支付</span>
                {elseif condition = "$order_info['order_status'] eq 10"}
                <span style="color:red;">租赁中</span>
                {/if}
            </div>
        </div>
        <div class="layui-form-item">
            <label for="order_type" class="layui-form-label">
                <span class="x-red">*</span>订单类型
            </label>
            <div class="layui-input-inline">
                {if condition = "$order_info['order_type'] eq 1"}
                   <span style="color:green;">快递</span>
                {elseif condition = "$order_info['order_type'] eq 2"}
                   <span style="color:green;">自提</span>
                {/if}
            </div>
        </div>
        <div class="layui-form-item">
            <label for="add_time" class="layui-form-label">
                <span class="x-red">*</span>下单时间
            </label>
            <div class="layui-input-inline">
                <input type="text" id="add_time" value="{$order_info['add_time']}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="user_name" class="layui-form-label">
                <span class="x-red">*</span>下单人
            </label>
            <div class="layui-input-inline">
                <input type="text" id="user_name" value="{$order_info['user_name']}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="user_phone" class="layui-form-label">
                <span class="x-red">*</span>下单人电话
            </label>
            <div class="layui-input-inline">
                <input type="text" id="user_phone" value="{$order_info['user_phone']}" autocomplete="off" class="layui-input">
            </div>
        </div>
        {if condition = "$order_info['order_type'] eq 1"}
            <div class="layui-form-item">
                <label for="getname" class="layui-form-label">
                    <span class="x-red">*</span>收货人
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="getname" value="{$order_info['name']}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="phone" class="layui-form-label">
                    <span class="x-red">*</span>收货人电话
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="phone" value="{$order_info['phone']}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="consignee" class="layui-form-label">
                    <span class="x-red">*</span>收货地址
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="consignee" value="{$order_info['consignee']}" autocomplete="off" class="layui-input">
                </div>
            </div>
        {/if}
        <div class="layui-form-item">
            <label for="goods_price" class="layui-form-label">
                <span class="x-red">*</span>订单金额
            </label>
            <div class="layui-input-inline">
                <input type="text" id="goods_price" value="{$order_info['goods_price']}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <?php if($order_info['order_status'] == 1){ ?>
           <?php if($order_info['order_type'] == 1){ ?>
            <div class="layui-form-item">
                    <label for="shipping_name" class="layui-form-label">
                        <span class="x-red">*</span>物流公司
                    </label>
                    <div class="layui-input-block">
                        <select name="shipping_id">
                            {volist name="$order_info.goods_shipping" id="vo"}
                            <option value="{$vo.shipping_id}">{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
              </div>
              <div class="layui-form-item">
                    <label for="numbers" class="layui-form-label">
                        <span class="x-red">*</span>物流号
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="numbers" value="" name="numbers" required="" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                    <label for="company_code" class="layui-form-label">
                        <span class="x-red">*</span>物流公司代码
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="company_code" value="" name="company_code" required="" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        <span class="x-red">*</span>
                    </div>
                </div> -->
                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label">
                    </label>
                    <button  class="layui-btn" lay-filter="admin" lay-submit>发货</button>
                </div>
           <?php }elseif($order_info['order_type'] == 2){ ?>
                <div class="layui-form-item">
                    <label for="L_repass" class="layui-form-label">
                    </label>
                    <button  class="layui-btn" lay-filter="admin" lay-submit>自提确定</button>
                </div>
           <?php } ?>
        <?php }elseif($order_info['order_status'] == 2 || $order_info['order_status'] == 3){ ?>
            <?php if($order_info['order_type'] == 1){ ?>
            <div class="layui-form-item">
                <label for="shipping_name" class="layui-form-label">
                    <span class="x-red">*</span>物流公司
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="shipping_name" value="{$order_info['shipping_name']}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="numbers" class="layui-form-label">
                    <span class="x-red">*</span>物流号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="numbers" value="{$order_info['numbers']}" autocomplete="off" class="layui-input">
                </div>
            </div>
          <?php } ?>
    <?php } ?>
    </form>
</div>
<script>
    layui.use(['upload','laydate'], function(){
        var $ = layui.jquery,
            upload = layui.upload;
        var laydate = layui.laydate;
    });




    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;
        form.render('select'); //刷新select选择框渲染
        //自定义验证规则
        form.verify({
        });

        //监听提交
        $(window).on('load', function() {
            form.on('submit(admin)', function(data) {
                $.ajax({
                    url:"{:url('Order/changeStatus')}",
                    data:$('#admin').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 200) {
                            layer.msg(res.msg, {icon: 6});
                            setInterval('parent.location.href="{:url('Order/orderList')}";',2000);
                        } else {
                            layer.msg(res.msg,{icon: 2});
                        }
                    }
                });
                return false;
            });
        });
    });
</script>
{include file="public/footer" /}